#pragma once
#include "nds.h"
#include <vector>
#include <algorithm>
#include <iostream>
#include "enum.h"

//! \brief This structure will store the background data contained in a .h
typedef struct {

	const unsigned int * data;
	int length;

}bgData;

class SpritesManager; //Forward declaration
class BackgroundManager;
class Application;

//! \class Game
//! \brief This class handles the game behavior (scrolling, sprite managing, background flags etc.)

class Game
{
public:

	SpritesManager* spritesManager;
	Game(BackgroundManager* _bgManager);
	~Game(void);

	void launchGame(Application* app, int level);
	void update(Application* app);
	void scroll(Application * app);
	void checkDayAndNight(Application* app);
	void checkCollision(Screen pos, Application* app);
	void checkPursuit(Application *app);
	void checkEndOfLevel(Application* app);
	void reset(Application *app);
	void heroFall(Application * app);

	//! \brief Return the background to be loaded
	bgData getBgToLoad();

	inline int getScrollValue() {return scrollValue;};
	unsigned int bgSpeedDif;
	int currentLevel;
	bool falling;
	

private:
	std::vector<int> backgroundSwitch;
	//! The scrolling value un pixel
	int scrollValue;
	int pursuerScrollValue;
	unsigned int pursuerSpeed;
	unsigned int pursuerTicks;

	BackgroundManager* backgroundManager;
	SunCycle sunCycle;

	int levelSize;
	

};

